package com.ryskoo.customer.customerintegrallog.domain;

import com.ryskoo.common.hclconstant.IntegralTypeEnum;
import com.ryskoo.framework.core.bean.BasicPO;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 会员积分日志（积分明细）
 * @author BeHappy
 */
@Entity
@Table(name = "cus_customer_integral_log")
public class CustomerIntegralLogPO extends BasicPO {

    /**
     * 积分主表uuid
     */
    @Column(name = "integral_uuid", columnDefinition = "char", length = 32)
    private String integralUuid;

    /**
     * 积分数
     */
    @Column(name = "integral")
    private int integral;

    /**
     * 积分类型
     */
    @Column(name = "type", columnDefinition = "tinyint", length = 2)
    private int type;

    /**
     * 订单编号
     */
    @Column(name = "order_id", columnDefinition = "varchar", length = 30)
    private String orderId;

    @Transient
    private String typeName;

    public String getIntegralUuid() {
        return integralUuid;
    }

    public void setIntegralUuid(String integralUuid) {
        this.integralUuid = integralUuid;
    }

    public int getIntegral() {
        return integral;
    }

    public void setIntegral(int integral) {
        this.integral = integral;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getTypeName() {
        return IntegralTypeEnum.getNameByValue(this.type);
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    @Override
    public String toString() {
        return "CustomerIntegralLogPO{" +
                "integralUuid='" + integralUuid + '\'' +
                ", integral=" + integral +
                ", type=" + type +
                ", orderId='" + orderId + '\'' +
                ", typeName='" + typeName + '\'' +
                '}';
    }
}
